//
//  EventSelelctpersonnelCell.m
//  ConvenientlyTake
//
//  Created by 森鑫 on 2022/12/23.
//

#import "EventSelelctpersonnelCell.h"
#import "EventUserListModel.h"

@implementation EventSelelctpersonnelCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    self.selectionStyle = UITableViewCellSelectionStyleNone;
}
- (IBAction)selelctBtnAction:(UIButton *)sender {
    sender.selected = !sender.selected;
    if (self.delegate && [self.delegate respondsToSelector:@selector(selelctItemWithEventDeptModel:)]){
        self.deptModel.isSelelct = sender.selected;
        [self.delegate selelctItemWithEventDeptModel:self.deptModel];
    }
    if (self.delegate && [self.delegate respondsToSelector:@selector(selelctItemWithEventUserListModel:)]){
        self.userListmodel.isSelelct = sender.selected;
        [self.delegate selelctItemWithEventUserListModel:self.userListmodel];
    }
}

- (void)setDeptModel:(EventDeptModel *)deptModel{
    if(deptModel){
        _deptModel = deptModel;
        self.contentLabel.text = [NSString stringWithFormat:@"%@" , deptModel.deptName];
        self.selelctBtn.selected = deptModel.isSelelct;
    }
}

- (void)setUserListmodel:(EventUserListModel *)userListmodel{
    if(userListmodel){
        _userListmodel = userListmodel;
        self.contentLabel.text = [NSString stringWithFormat:@"%@(%@)" , userListmodel.name , userListmodel.phoneNumber];
        self.selelctBtn.selected = userListmodel.isSelelct;
    }
}

@end
